package com.pandorasoft.shiro

import org.grails.datastore.gorm.finders.MethodExpression.InList;

class ShiroModule {

	/*
	 * Default (injected) attributes of GORM
	 */
	//	Long	id
	String name
	String controllerName
	String actionName
	String root
	ShiroModule parent
	Date dateCreated
	Date lastUpdated

	static belongsTo = [parent:ShiroModule]
	static hasMany = [childrens:ShiroModule]

	//	static belongsTo	= []	// tells GORM to delete this object if the "parent" is deleted.
	//	static hasOne		= []
	//	static hasMany		= []
	//	static mappedBy		= []

	static mapping = {
		childrens(lazy:false)
	}

	static constraints = {
		name(nullable:false,blank:false)
		controllerName(nullable:true)
		actionName(nullable:true)
		root(InList:["YES", "NO"])
		parent(nullable:true)
//		childrens(lazy: false)

	}

	String toString() {
		return name
	}

	/*
	 * Methods of the Domain Class
	 */
}
